/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Ira
 */
public class UserLateCellRenderer extends DefaultTableCellRenderer {
	@Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

		String val = (String)value;
		if(val.equals("")) {
			this.setText("");
			this.setBackground(Color.decode("#CCCCCC"));
			return this;
		}
		else if(Integer.parseInt(val)>0) {
			this.setBackground(Color.decode("#FF7B7B"));
		}
		else {
			this.setBackground(Color.WHITE);
		}
		this.setText(val);
        return this;
    }
}
